package biz

import (
	"context"
	"github.com/go-kratos/kratos/v2/log"
	"gorm.io/gorm"
	"phm/models/generator/model"
)

type ScTeachDatumRepo interface {
	CreateScTeachDatum(ctx context.Context, uModel *model.ScTeachDatum, db *gorm.DB) error
	UpdateScTeachDatum(ctx context.Context, uModel *model.ScTeachDatum, db *gorm.DB) error
	DeleteScTeachDatumByIds(ctx context.Context, ids []string, db *gorm.DB) error
	GetScTeachDatumById(ctx context.Context, id string) (*model.ScTeachDatum, error)
	GetScTeachDatumByIds(ctx context.Context, ids []string) ([]*model.ScTeachDatum, error)
	GetScTeachDatumList(ctx context.Context, query string, pageNum, pageSize int64) ([]*model.ScTeachDatum, int64, error)
	// GetDB 得到db以方便事务处理
	GetDB() *gorm.DB
}

type ScTeachDatumUseCase struct {
	scTeachDatum ScTeachDatumRepo
	log          *log.Helper
}

func NewScTeachDatumUseCase(scTeachDatum ScTeachDatumRepo, logger log.Logger) *ScTeachDatumUseCase {
	return &ScTeachDatumUseCase{
		scTeachDatum: scTeachDatum,
		log:          log.NewHelper(logger),
	}
}
